<#include "../Common/basepage.ftl">
<@addCSS [
"/app/lib/css/plugins/datapicker/bootstrap-datetimepicker",
"/app/lib/css/plugins/datapicker/bootstrap-datetimepicker.min",
"/app/lib/css/bootstrap-multiselect"
]/>

<@addJS [
"/app/lib/js/plugins/validate/jquery.validate.min",
"/app/lib/js/plugins/datapicker/bootstrap-datetimepicker",
"/app/lib/js/bootstrap-multiselect"
]/>
<@common "创建新工作">
<div class="row">
	<input type="hidden" id="group" value="workprogress"/>
	<input type="hidden" id="item" value="workingtablelist"/>
	<div class="col-lg-12">
		<div class="ibox float-e-margins">
			<div class="ibox-title">
				<div class="ibox-tools">
					<a class="close-link" onclick="goback()"> <i class="fa fa-times"></i></a>
				</div>
			</div>
			<div class="ibox-content">
				<input type="hidden" id="subModule" value="eventreportfkitem"/>
				<form method="get" class="form-horizontal" id="iform" accept-charset="utf-8" action="${servePath}/pc/workingtable/submitForm">
					<input type="hidden" id="id" name="id" value="${(dataAO.id)!}"/>
					
					<div class="form-group">
						<div class="col-sm-4 col-sm-offset-2">
							<button class="btn btn-primary" type="button" onclick="saveform()">确认保存</button>
							<a href="javascript:void(0)" class="btn btn-primary" onclick="goback()">取消</a>
						</div>
					</div>
					
					
					<div class="form-group"><label class="col-sm-2 control-label">工作类型</label>
					  <div class="col-sm-1">
					     <select class="form-control m-b" id="jobType" name="jobType">
					       <option value = "运维">
					            <#if "${(datdAO.jobType)!}" == "运维" > selected="true" </#if>运维</option>>
					       <option value = "项目">
					            <#if "${(datdAO.jobType)!}" == "项目" > selected="true" </#if>项目</option>>
					       <option value = "数据">
					            <#if "${(datdAO.jobType)!}" == "数据" > selected="true" </#if>数据</option>>
					       <option value = "其它">
					            <#if "${(datdAO.jobType)!}" == "其它" > selected="true" </#if>其它</option>>
						  </select>
					</div>
				</div>
					
					
					<div class="form-group"><label class="col-sm-2 control-label">是否督办完成</label>
					  <div class="col-sm-1">
					     <select class="form-control m-b" id="doesSupervise" name="doesSupervise">
					       <option value = "是">
					            <#if "${(datdAO.doesSupervise)!}" == "是" > selected="true" </#if>是</option>>
					       <option value = "否">
					            <#if "${(datdAO.doesSupervise)!}" == "否" > selected="true" </#if>否</option>>
					       </select>
					</div>
				</div>
					
				
					
					<div class="form-group"><label class="col-sm-2 control-label">状态</label>
					  <div class="col-sm-2">
					     <select class="form-control m-b" id="status" name="status">
					       <option value = "0">
					            <#if "${(datdAO.status)!}" == "进行" > selected="true" </#if>进行</option>
					       
					       <option value = "1">
					            <#if "${(datdAO.status)!}" == "中止" > selected="true" </#if>中止</option>

					       <option value = "2">
					            <#if "${(datdAO.status)!}" == "结束" > selected="true" </#if>结束</option>
					       </select>
					</div>
				</div>
				
				
					<div class="form-group">
						<label class="col-sm-2 control-label" style="padding-top:10px"><font style="color:red">事项</font></label>
						<div class="col-sm-10">
							<input id="jobName" type="text" placeholder="事项" class="form-control"
								required="" maxlength="210" name ="jobName" value="${(dataAO.jobName)!}">
						</div>
					</div>

                    <div class="form-group"><label class="col-sm-2 control-label">负责人</label>
					  <div class="col-sm-2">
					       <input id="remark" type="hidden" name ="remark" value="${(dataAO.remark)!}">
						   <select  class="form-control m-b" id="example-getting-started" multiple="multiple">
					      </select>
					</div>
				   </div>				
                    
				</form>
			</div>
		</div>
	</div>
</div>
<script>
	function goback(){
        window.location.href="${servePath}/pc/workingtable/list";
	}
	
	function saveform(){
		var form = $("#iform");
		if(form.valid()){
			$("form").submit();
		}else{
			return
		};		
	}
	
	$(document).ready(function(){
	   //è·åè´£ä»»äºº
       var preperson=document.getElementById("remark").value;
       //åå§åä¸æé¡¹
        var list = new Array();
		<#list persondata as data>
			list[${data_index}] = {"personid":"${data.id}","personname":"${data.staffName}"};
		</#list>
		var obj=document.getElementById('example-getting-started');
		for(var i=0;i<list.length;i++){	 
            obj.options.add(new Option(list[i].personname,list[i].personid)); //è¿ä¸ªå¼å®¹IEä¸firefox 
		}
		//åå§åè´£ä»»äººéæ©
		var strpre= new Array();
		if(preperson !==""){
		   strpre0=preperson.replace(/,/g,'a'); 
           strpre=strpre0.split("a");
          for(var i=0; i<strpre.length; i++){
			for(var j=0;j<obj.length;j++){
                 if(obj[j].value == strpre[i])
                 obj[j].selected = true;
				 }
           }
        }; 
		//ä¸æè®¾ç½®
        $('#example-getting-started').multiselect({
                    buttonWidth: '400px',
                    enableFiltering: true,
                    maxHeight: 200,
                    onChange: function(option, checked, select) {
                               var checkValue=$("#example-getting-started").val(); 
                               document.getElementById("remark").value=checkValue;
            }
            });
           

    });	  
		
</script>


</@common>